/*
Kakine
ActionScript Framework
Copyright © 2011, PUNY, LLC.

This file is part of KAKINE.

KAKINE is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

KAKINE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with KAKINE.  If not, see <http://www.gnu.org/licenses/>.
*/ 
package com.puny.utils.easing
{
	public class BothEndsTrigonometricEasing extends TrigonometricEasingImpl {
		/**
		 * Starts slowly and stops slowly
		 * @param start start position
		 * @param end end position
		 * @param count ends after <code>count</code> frames.
		 * @param effect should be between 0 (minium) and 1 (maximum). 
		 */
		public function BothEndsTrigonometricEasing(start:Number,end:Number,count:uint,effect:Number) {
			super(start, end, count);
			populateSin(effect);
		}
		
		public function updateParams(start:Number, end:Number, count:uint, effect:Number):void {
			updateCoreParams(start,end,count);
			populateSin(effect);
		}
		
		private function populateSin(effect:Number):void {
			var e:Number = effect < 0? 0 : ((effect > 1) ? 1 : effect);
			var w:Number = 2 * Math.PI / (frame);
			var a:Number = e * _vx / Math.sin(w);
			for(var i:int = 0;i < frame;i++) {
				_Asin.push(a * Math.sin(w * i));
			}
		}
		
	}
}